package com.sws.person.domain;

import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.sws.person.util.MultiDateDeserializer;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.sws.common.annotation.Excel;
import com.sws.common.core.domain.BaseEntity;
import org.springframework.data.annotation.Transient;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 人员信息对象 per_person
 * 
 * @author cx
 * @date 2025-06-09
 */
@ApiModel(description = "人员信息对象，包含人员的基本信息和状态")
public class PerPerson extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /** 主键 */
    @ApiModelProperty(value = "主键ID", example = "1")
    private Long id;

    /** 设备端人员ID
     *  现在已改为设备端的SN号，逻辑上进行处理
     * */
    @Excel(name = "设备端人员ID")
    @ApiModelProperty(value = "设备端人员ID", example = "PID12345")
    private String pid;

    /** 关联设备ID */
    @Excel(name = "关联设备ID")
    @ApiModelProperty(value = "关联设备ID", example = "DEVICE123")
    private String deviceId;

    /** 姓名 */
    @Excel(name = "姓名")
    @ApiModelProperty(value = "人员姓名", example = "张三")
    private String name;

    /** 人员类别 */
    @Excel(name = "人员类别")
    @ApiModelProperty(value = "人员类别", example = "1")
    private Integer category;

    /** 性别 */
    @Excel(name = "性别")
    @ApiModelProperty(value = "性别，0表示男，1表示女", example = "0")
    private Integer gender;

    /** 年龄 */
    @Excel(name = "年龄")
    @ApiModelProperty(value = "年龄", example = "25")
    private Integer age;

    /** 部门/职位 */
    @Excel(name = "部门/职位")
    @ApiModelProperty(value = "部门或职位", example = "研发部")
    private String department;

    /** 工作状态 */
    @Excel(name = "工作状态")
    @ApiModelProperty(value = "工作状态，0表示在职，1表示离职", example = "0")
    private Integer workStatus;

    /** 手机号 */
    @Excel(name = "手机号")
    @ApiModelProperty(value = "手机号码", example = "13812345678")
    private String phone;

    /** 身份证号 */
    @Excel(name = "身份证号")
    @ApiModelProperty(value = "身份证号码", example = "123456789012345678")
    private String idCardNo;

    /** 工号 */
    @Excel(name = "工号")
    @ApiModelProperty(value = "工号", example = "G001")
    private String workId;

    /** IC卡号 */
    @Excel(name = "IC卡号")
    @ApiModelProperty(value = "IC卡号", example = "IC12345")
    private String icCardNo;

    /** 人员照片 */
    @Excel(name = "人员照片")
    @ApiModelProperty(value = "人员照片URL", example = "http://example.com/photo.jpg")
    private String photo;

    /** 最后出现时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "最后出现时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = MultiDateDeserializer.class)
    @ApiModelProperty(value = "最后出现时间", example = "2025-06-09 14:30:00")
    private Date lastAppearTime;

    /** 删除标志 */
    @ApiModelProperty(value = "删除标志，0表示正常，1表示已删除", example = "0")
    private Integer delFlag;

    @Excel(name = "班级")
    @ApiModelProperty(value = "班级名称", example = "高三一班")
    private String classes;

    @Excel(name = "学生ID")
    @ApiModelProperty(value = "学生ID", example = "STU12345")
    private String studentId;

    // 在 PerPerson 类中添加设备ID列表字段
    @ApiModelProperty(value = "关联设备ID列表", example = "['DEVICE123', 'DEVICE456']")
    private List<String> deviceIds;

    public List<String> getDeviceIds() {
        return deviceIds;
    }

    public void setDeviceIds(List<String> deviceIds) {
        this.deviceIds = deviceIds;
    }

    public String getClasses() {
        return classes;
    }

    public void setClasses(String classes) {
        this.classes = classes;
    }

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    @Transient // 表示非数据库字段
    @ApiModelProperty(value = "照片是否被修改标志", example = "false")
    private Boolean photoChanged = false;

    @Transient// 不持久化到数据库
    @ApiModelProperty(value = "Base64编码的照片数据", example = "...")
    private String photoBase64;

    public String getPhotoBase64() {
        return photoBase64;
    }

    public void setPhotoBase64(String photoBase64) {
        this.photoBase64 = photoBase64;
    }

    public Boolean getPhotoChanged() {
        return photoChanged;
    }

    public void setPhotoChanged(Boolean photoChanged) {
        this.photoChanged = photoChanged;
    }

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }

    public void setPid(String pid) 
    {
        this.pid = pid;
    }

    public String getPid() 
    {
        return pid;
    }

    public void setDeviceId(String deviceId) 
    {
        this.deviceId = deviceId;
    }

    public String getDeviceId() 
    {
        return deviceId;
    }

    public void setName(String name) 
    {
        this.name = name;
    }

    public String getName() 
    {
        return name;
    }

    public void setCategory(Integer category) 
    {
        this.category = category;
    }

    public Integer getCategory() 
    {
        return category;
    }

    public void setGender(Integer gender) 
    {
        this.gender = gender;
    }

    public Integer getGender() 
    {
        return gender;
    }

    public void setAge(Integer age) 
    {
        this.age = age;
    }

    public Integer getAge() 
    {
        return age;
    }

    public void setDepartment(String department) 
    {
        this.department = department;
    }

    public String getDepartment() 
    {
        return department;
    }

    public void setWorkStatus(Integer workStatus) 
    {
        this.workStatus = workStatus;
    }

    public Integer getWorkStatus() 
    {
        return workStatus;
    }

    public void setPhone(String phone) 
    {
        this.phone = phone;
    }

    public String getPhone() 
    {
        return phone;
    }

    public void setIdCardNo(String idCardNo) 
    {
        this.idCardNo = idCardNo;
    }

    public String getIdCardNo() 
    {
        return idCardNo;
    }

    public void setWorkId(String workId) 
    {
        this.workId = workId;
    }

    public String getWorkId() 
    {
        return workId;
    }

    public void setIcCardNo(String icCardNo) 
    {
        this.icCardNo = icCardNo;
    }

    public String getIcCardNo() 
    {
        return icCardNo;
    }

    public void setPhoto(String photo) 
    {
        this.photo = photo;
    }

    public String getPhoto() 
    {
        return photo;
    }

    public void setLastAppearTime(Date lastAppearTime) 
    {
        this.lastAppearTime = lastAppearTime;
    }

    public Date getLastAppearTime() 
    {
        return lastAppearTime;
    }

    public void setDelFlag(Integer delFlag) 
    {
        this.delFlag = delFlag;
    }

    public Integer getDelFlag() 
    {
        return delFlag;
    }

    @Override
    public String toString() {
        return "PerPerson{" +
                "id=" + id +
                ", pid='" + pid + '\'' +
                ", deviceId='" + deviceId + '\'' +
                ", name='" + name + '\'' +
                ", category=" + category +
                ", gender=" + gender +
                ", age=" + age +
                ", department='" + department + '\'' +
                ", workStatus=" + workStatus +
                ", phone='" + phone + '\'' +
                ", idCardNo='" + idCardNo + '\'' +
                ", workId='" + workId + '\'' +
                ", icCardNo='" + icCardNo + '\'' +
                ", photo='" + photo + '\'' +
                ", lastAppearTime=" + lastAppearTime +
                ", delFlag=" + delFlag +
                ", classes='" + classes + '\'' +
                ", studentId='" + studentId + '\'' +
                ", photoChanged=" + photoChanged +
                ", photoBase64='" + photoBase64 + '\'' +
                '}';
    }
}
